﻿using Furion.DependencyInjection;
using Furion.EventBus;
using FurionApi.Demo.Core.EventSubscriber.Dto;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FurionApi.Demo.Core
{
    public class LogEventSubscriber : IEventSubscriber, ISingleton
    {
        private readonly ILogger<LogEventSubscriber> logger;

        public IServiceProvider Services { get; }

        public LogEventSubscriber(IServiceProvider services, ILogger<LogEventSubscriber> logger)
        {
            Services = services;
            this.logger = logger;
        }

        [EventSubscribe("Create:OpLog")]
        public async Task CreateOpLog(EventHandlerExecutingContext context)
        {
            var log = (SysLogOp)context.Source.Payload;
        }
        [EventSubscribe("Create:ExLog")]
        public async Task CreateExLog(EventHandlerExecutingContext context)
        {
            var log = (SysLogEx)context.Source.Payload;
        }
        [EventSubscribe("Create:VisLog")]
        public async Task CreateVisLog(EventHandlerExecutingContext context)
        {
            var log = (SysLogVis)context.Source.Payload;
        }
    }
}
